//“网页”下拉菜单的切换
function menu_toggle(){
	var xx = document.getElementById("dropdown");
	if(xx.style.display=="none"){
		xx.style.display="block";
	}else{
		xx.style.display="none";
	}
}
//body加载完，执行函数来读取cookie
function init()
{
	var data = readCookie('skin');
	if(data == null){
		data = 'default';
	}
	if (data == 'default') {
		document.getElementById("linkid").href = "default.css";
	} else if (data == 'red') {
		document.getElementById("linkid").href = "hao123red.css";
	} else if (data == 'orange') {
		document.getElementById("linkid").href = "hao123orange.css";
	} else if (data == 'blue') {
		document.getElementById("linkid").href="hao123blue.css";
	} else if (data == 'green') {
		document.getElementById("linkid").href="hao123green.css";
	}
}
//执行换肤的函数
function changeSkin(e) {
	var data = e.getAttribute('data');
	if (data == 'default') {
		document.getElementById("linkid").href = "default.css";
	} else if (data == 'red') {
		document.getElementById("linkid").href = "hao123red.css";
	} else if (data == 'orange') {
		document.getElementById("linkid").href = "hao123orange.css";
	} else if (data == 'blue') {
		document.getElementById("linkid").href="hao123blue.css";
	} else if (data == 'green') {
		document.getElementById("linkid").href="hao123green.css";
	}

	createCookie('skin',data,8);
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}





